package tencent;

import java.util.Arrays;
import java.util.Scanner;

public class Main4 {
    public static void getMain(int len, int circle, int[] nums){
        int cur=0;

        for (int i=0;i<circle;i++){

            if (i>=nums.length){
                System.out.print("0");
                if (i!=circle-1){
                    System.out.print("\n");
                }
                continue;
            }

            if (nums[i]==cur){
                circle+=1;
                continue;
            }
            System.out.print(nums[i]-cur);
            cur = nums[i];
            if (i!=circle-1){
                System.out.print("\n");
            };
        }
    }

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int len = sc.nextInt();
        int circle = sc.nextInt();
        int[] nums = new int[len];
        for (int i=0;i<len;i++){
            nums[i] = sc.nextInt();
        }
        Arrays.sort(nums);
        getMain(len,circle,nums);
    }
}
